//Original source: http://www.codeproject.com/KB/aspnet/validation_engine.aspx
namespace Jaws.Core.Web.Entities.Validation.CustomAttributes
{
    public class MinLengthAttribute : ValidationAttribute
    {

        public MinLengthAttribute(int minLength)
        {
            MinLength = minLength;
            Message = string.Format(ValidationMessages.RequiredLength, minLength);
        }

        private int MinLength { get; set; }

        public override bool IsValid(object item)
        {
            return ((string) item).Length >= MinLength;
        }
    }
}